package permission

import (
	"context"
	"fmt"
	model "go-admin/base/mongo"

	"github.com/zeromicro/go-zero/core/logx"
	"go-admin/base/internal/svc"
)

type DemoLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewDemoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DemoLogic {
	return &DemoLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DemoLogic) Demo() error {
	// todo: add your logic here and delete this line
	message := model.Message{
		FromID:   1,
		ToID:     2,
		FromName: "dsada",
		ToName:   "dada",
		Type:     1,
		Content:  "dasdadadadad---",
	}

	l.svcCtx.MessageModel.Insert(l.ctx, &message)
	fmt.Println(message)
	fmt.Println(message.ID)
	return nil
}
